package com.robcity.platform.common;




import com.robcity.platform.enums.RespEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class BusinessException extends RuntimeException {

    private static final long serialVersionUID = -6594990047869068642L;

    //service里抛出异常，全局可以捕获，不用一层一层往外传到controller里
    private int code;
    private String msg;

    public BusinessException(RespEnum resultEnum) {
        this.code = resultEnum.getCode();
        this.msg = resultEnum.getMsg();
    }
}
